package com.qfmy.web.controller;

import com.qfmy.web.consts.Result;
import com.qfmy.web.service.FileUploadService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: 廖志伟
 * @date: 2024-11-28
 * @Description: 文件上传
 */
@RestController
@SuppressWarnings("all")
public class FileUploadController {
    //注入文件上传服务
    @Resource
    private FileUploadService fileuploadservice;

    /**
     * 文件上传
     */
    @PostMapping("/upload")
    public Result userImage(@RequestParam MultipartFile file) {
        //上传用户头像
        String url = fileuploadservice.upload(file);
        return Result.success(200,url);
    }

}
